//
//  HOTCHATEmptyView.h
//  ChatForHot
//
//  Created by wr on 2018/10/17.
//  Copyright © 2018年 FLY. All rights reserved.
//

#import <UIKit/UIKit.h>

typedef void(^HOTCHATEmptyViewTapBlock)(void);

@protocol HOTCHATEmptyViewLoadingViewProtocol <NSObject>

@optional

- (void)startAnimating; // 当调用 setLoadingViewHidden:NO 时，系统将自动调用此处的 startAnimating

@end

@interface HOTCHATEmptyView : UIView

// 布局顺序从上到下依次为：imageView, loadingView, textLabel, detailTextLabel, actionButton
@property(nonatomic, strong) UIView<HOTCHATEmptyViewLoadingViewProtocol> *loadingView;

@property(nonatomic, strong, readonly) UIImageView *imageView;
@property(nonatomic, strong, readonly) UILabel *textLabel;
@property(nonatomic, strong, readonly) UILabel *detailTextLabel;
@property(nonatomic, strong, readonly) UIButton *actionButton;

// 可通过调整这些insets来控制间距
@property(nonatomic, assign) UIEdgeInsets imageViewInsets;   // 默认为(0, 0, 36, 0)
@property(nonatomic, assign) UIEdgeInsets loadingViewInsets;     // 默认为(0, 0, 36, 0)
@property(nonatomic, assign) UIEdgeInsets textLabelInsets;   // 默认为(0, 0, 10, 0)
@property(nonatomic, assign) UIEdgeInsets detailTextLabelInsets; // 默认为(0, 0, 10, 0)
@property(nonatomic, assign) UIEdgeInsets actionButtonInsets;    // 默认为(0, 0, 0, 0)
@property(nonatomic, assign) CGFloat verticalOffset; // 如果不想要内容整体垂直居中，则可通过调整此属性来进行垂直偏移。默认为-30，即内容比中间略微偏上

// 字体
@property(nonatomic, strong) UIFont *textLabelFont;  // 默认为15pt系统字体
@property(nonatomic, strong) UIFont *detailTextLabelFont;    // 默认为14pt系统字体
@property(nonatomic, strong) UIFont *actionButtonFont;   // 默认为15pt系统字体

// 颜色
@property(nonatomic, strong) UIColor *textLabelTextColor;    // 默认为(93, 100, 110)
@property(nonatomic, strong) UIColor *detailTextLabelTextColor;  // 默认为(133, 140, 150)
@property(nonatomic, strong) UIColor *actionButtonTitleColor;    // 默认为MDUICMI.buttonTintColor

// tap
@property(nonatomic, copy  ) HOTCHATEmptyViewTapBlock emptyTapBlock;

// 显示或隐藏loading图标
- (void)setLoadingViewHidden:(BOOL)hidden;

/**
 * 设置要显示的图片
 * @param image 要显示的图片，为nil则不显示
 */
- (void)setImage:(UIImage *)image;

/**
 * 设置提示语
 * @param text 提示语文本，若为nil则隐藏textLabel
 */
- (void)setTextLabelText:(NSString *)text;

/**
 * 设置详细提示语的文本
 * @param text 详细提示语文本，若为nil则隐藏detailTextLabel
 */
- (void)setDetailTextLabelText:(NSString *)text;

/**
 * 设置操作按钮的文本
 * @param title 操作按钮的文本，若为nil则隐藏actionButton
 */
- (void)setActionButtonTitle:(NSString *)title;

/**
 *  如果要继承MDUIEmptyView并添加新的子 view，则必须：
 *  1. 像其它自带 view 一样添加到 contentView 上
 *  2. 重写sizeThatContentViewFits
 */
@property(nonatomic, strong, readonly) UIView *contentView;

- (CGSize)sizeThatContentViewFits;  // 返回一个恰好容纳所有子 view 的大小

@end

